package com.techstar.mqttprocesser.service.mqtt.utils;

import com.techstar.mqttprocesser.service.mqtt.config.MqttClientProperties;

import java.util.HashSet;
import java.util.Set;

/**
 * @author lilei
 * @create 2025-03-27-2025/3/27
 */
// 示例：校验 topic 是否存在重复或方向冲突
public class MQTTConfigValidator {
    public void validate(MqttClientProperties props) {
        Set<String> allTopics = new HashSet<>();
        props.getSubscribeTopics().forEach(t -> {
            if (allTopics.contains(t.getTopic())) {
                throw new IllegalArgumentException("Duplicate topic: " + t.getTopic());
            }
            allTopics.add(t.getTopic());
        });
        // 其他校验逻辑...
    }
}
